/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Dao;

import Entity.SinhVienEntity;
import Util.ConSQL;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Date;
import java.util.Vector;
import javax.swing.JComboBox;
import javax.swing.JOptionPane;
import javax.swing.JTable;
import javax.swing.table.DefaultTableModel;

/**
 *
 * @author use
 */
public class Sinhvien {

    ConSQL cs = new ConSQL();

    public boolean trungMa(String ma) throws Exception {
        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select maSV from sinhVien where maSV='" + ma + "';");
        if (rs.next() == true) {
            return true;
        } else {
            return false;
        }
    }

    public boolean trungMaSua(String mamoi, String macu) throws Exception {
        if (mamoi.equals(macu)) {
            return false;
        } else {
            Statement st = cs.getCon().createStatement();
            ResultSet rs = st.executeQuery("select maSV from sinhVien where maSV='" + mamoi + "';");
            if (rs.next() == true) {
                return true;
            } else {
                return false;
            }
        }
    }

    public boolean trungCMT(String cmt) throws Exception {
        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select maSV from sinhVien where SCMND='" + cmt + "';");
        if (rs.next() == true) {
            return true;
        } else {
            return false;
        }
    }

    public boolean trungCMTSua(String cmtMoi, String cmtCu) throws Exception {
        if (cmtMoi.equals(cmtCu)) {
            return false;
        } else {
            Statement st = cs.getCon().createStatement();
            ResultSet rs = st.executeQuery("select maSV from sinhVien where SCMND='" + cmtMoi + "';");
            if (rs.next() == true) {
                return true;
            } else {
                return false;
            }
        }
    }

    public int themSinhvien(String ma, String maLopSH, String hoten, String ngaysinh, String gioitinh, String quequan, String dienthoai, String Email, String SCMND, String doituong, String ghichu) throws Exception {
        int rs = 0;
        if (!trungMa(ma) && !trungCMT(SCMND)) {
            Statement st = cs.getCon().createStatement();
            rs = st.executeUpdate("insert into sinhVien values('" + ma + "','" + maLopSH + "',N'" + hoten + "','" + ngaysinh + "',N'" + gioitinh + "',N'" + quequan + "','" + dienthoai + "','" + Email + "','" + SCMND + "',N'" + doituong + "',N'" + ghichu + "');");
        }
        return rs;
    }

    public boolean trungHocphan(String maLopHP, String maSV) throws SQLException, Exception {
        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select maSV from lopHP_SV where SCMND='" + maLopHP + "' and maSV='" + maSV + "';");
        if (rs.next() == true) {
            return true;
        } else {
            return false;
        }
    }

    public void dangkiHocphan(String maLopHP, String maSV) throws SQLException, Exception {
        if (!trungHocphan(maLopHP, maSV)) {
            Statement st = cs.getCon().createStatement();
            int rs = st.executeUpdate("insert into lopHP_SV values('" + maLopHP + "','" + maSV + "');");
        }
    }

    public int suaSinhvien(String ma, String malopSH, String hoten, String ngaysinh, String gioitinh, String quequan, String dienthoai, String email, String SCMND, String doituong, String ghichu) throws SQLException, Exception {
        int rs = 0;
        Statement st = cs.getCon().createStatement();
        rs = st.executeUpdate("update sinhVien set malopSH='" + malopSH + "',hoTen=N'" + hoten + "',ngaySinh='" + ngaysinh + "',gioiTinh=N'" + gioitinh + "',queQuan=N'" + quequan + "',phone='" + dienthoai + "',email='" + email + "',SCMND='" + SCMND + "',doiTuong=N'" + doituong + "',ghiChu=N'" + ghichu + "' where maSV='" + ma + "';");
        return rs;
    }

    public int xoaSinhvien(String ma) throws SQLException, Exception {
        int rs = 0;
        Statement st = cs.getCon().createStatement();
        rs = st.executeUpdate("delete from sinhVien where maSV='" + ma + "';");
        return rs;
    }

    public String layMaLopSH(String tenLopSH, String tenNK) throws Exception {
        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select malopSH from lopSH,nienKhoa where tenlopSH=N'" + tenLopSH + "' and nienKhoa.maNK=lopSH.maNK and tenNK='" + tenNK + "';");
        while (rs.next()) {
            return rs.getString(1);
        }
        return rs.getString(1);
    }
    //tao cac tieu de cho bang

    public void createTitle(Vector tableTitle) {
        tableTitle.add("Mã sinh viên");
        tableTitle.add("Họ tên");
        tableTitle.add("Ngày sinh");
        tableTitle.add("Giới tính");
        tableTitle.add("Quê quán");
        tableTitle.add("Điện thoại");
        tableTitle.add("Email");
        tableTitle.add("SCMND");
        tableTitle.add("Đối tượng");
        tableTitle.add("Ghi chú");
    }
    //tao cac row cho bang

    public void createRecord(Vector tableRecord, ResultSet rs) throws SQLException {
        while (rs.next()) {
            Vector data = new Vector();
            data.add(rs.getString(1));
            data.add(rs.getString(2));
            data.add(rs.getString(3));
            data.add(rs.getString(4));
            data.add(rs.getString(5));
            data.add(rs.getString(6));
            data.add(rs.getString(7));
            data.add(rs.getString(8));
            data.add(rs.getString(9));
            data.add(rs.getString(10));
            tableRecord.add(data);
//            tableModel.addRow(data);
        }
    }
    //xem danh sach sinh vien theo ten khoa,ten lop,ten nien khoa

    public JTable xemDSSV(JTable table, Vector tableRecord, Vector tableTitle) throws Exception {
        tableRecord.removeAllElements();
        tableTitle.removeAllElements();

        createTitle(tableTitle);

        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select distinct maSV,hoTen,ngaySinh,gioiTinh,queQuan,phone,email,SCMND,doiTuong,ghiChu from sinhVien,lopSH,nienKhoa,khoa where sinhVien.MaLopSH=LopSH.MaLopSH and Khoa.MaKhoa = lopSH.MaKhoa and LopSH.MaNK=Nienkhoa.MaNK;");

        createRecord(tableRecord, rs);
        table.setModel(new DefaultTableModel(tableRecord, tableTitle));
        return table;
    }

    public JTable timDSSVByTenkhoaTenLopSHvaTenNK(String tenkhoa, String tenlopSH, String tenNK, JTable table, Vector tableRecord, Vector tableTitle) throws Exception {
        tableRecord.removeAllElements();
        tableTitle.removeAllElements();

        createTitle(tableTitle);

        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select distinct maSV,hoTen,ngaySinh,gioiTinh,queQuan,phone,email,SCMND,doiTuong,ghiChu from sinhVien,lopSH,nienKhoa,khoa where sinhVien.malopSH=lopSH.malopSH and khoa.makhoa = lopSH.makhoa and khoa.tenkhoa=N'" + tenkhoa + "' and lopSH.maNK=nienKhoa.maNK and nienKhoa.tenNK='" + tenNK + "' and lopSH.tenlopSH=N'" + tenlopSH + "';");
        createRecord(tableRecord, rs);
        table.setModel(new DefaultTableModel(tableRecord, tableTitle));
        return table;
    }

    public JTable timDSSVByTenKhoavaTenNK(String tenkhoa, String tenNK, JTable table, Vector tableRecord, Vector tableTitle) throws Exception {
        tableRecord.removeAllElements();
        tableTitle.removeAllElements();

        createTitle(tableTitle);

        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select distinct maSV,hoTen,ngaySinh,gioiTinh,queQuan,phone,email,SCMND,doiTuong,ghiChu from sinhVien,lopSH,nienKhoa,khoa where sinhVien.malopSH=lopSH.malopSH and khoa.makhoa = lopSH.makhoa and khoa.tenkhoa=N'" + tenkhoa + "' and lopSH.maNK=nienKhoa.maNK and nienKhoa.tenNK='" + tenNK + "';");
        createRecord(tableRecord, rs);
        table.setModel(new DefaultTableModel(tableRecord, tableTitle));
        return table;
    }
    //tim theo ten khoa va ten lop sinh hoat

    public JTable timDSSVByTenKhoavaTenLopSH(String tenkhoa, String tenLopSH, JTable table, Vector tableRecord, Vector tableTitle) throws Exception {
        tableRecord.removeAllElements();
        tableTitle.removeAllElements();

        createTitle(tableTitle);

        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select distinct maSV,hoTen,ngaySinh,gioiTinh,queQuan,phone,email,SCMND,doiTuong,ghiChu from sinhVien,lopSH,nienKhoa,khoa where sinhVien.malopSH=lopSH.malopSH and khoa.makhoa = lopSH.makhoa and khoa.tenkhoa=N'" + tenkhoa + "' and lopSH.maNK=nienKhoa.maNK and lopSH.tenlopSH=N'" + tenLopSH + "';");
        createRecord(tableRecord, rs);
        table.setModel(new DefaultTableModel(tableRecord, tableTitle));
        return table;
    }
    //tim theo ten khoa

    public JTable timDSSVByTenKhoa(String tenkhoa, JTable table, Vector tableRecord, Vector tableTitle) throws Exception {
        tableRecord.removeAllElements();
        tableTitle.removeAllElements();

        createTitle(tableTitle);

        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select distinct maSV,hoTen,ngaySinh,gioiTinh,queQuan,phone,email,SCMND,doiTuong,ghiChu from sinhVien,lopSH,nienKhoa,khoa where sinhVien.malopSH=lopSH.malopSH and khoa.makhoa = lopSH.makhoa and khoa.tenkhoa=N'" + tenkhoa + "';");
        createRecord(tableRecord, rs);
        table.setModel(new DefaultTableModel(tableRecord, tableTitle));
        return table;
    }
    //tim theo ten NK

    public JTable timDSSVByNK(String tenNK, JTable table, Vector tableRecord, Vector tableTitle) throws Exception {
        tableRecord.removeAllElements();
        tableTitle.removeAllElements();

        createTitle(tableTitle);

        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select distinct maSV,hoTen,ngaySinh,gioiTinh,queQuan,phone,email,SCMND,doiTuong,ghiChu from sinhVien,lopSH,nienKhoa,khoa where sinhVien.malopSH=lopSH.malopSH and khoa.makhoa = lopSH.makhoa and lopSH.maNK=nienKhoa.maNK and nienKhoa.tenNK='" + tenNK + "';");
        createRecord(tableRecord, rs);
        table.setModel(new DefaultTableModel(tableRecord, tableTitle));
        return table;
    }
    //tim theo ma Sinh vien

    public JTable timDSSVByMaSV(String maSV, JTable table, Vector tableRecord, Vector tableTitle) throws Exception {
        tableRecord.removeAllElements();
        tableTitle.removeAllElements();

        createTitle(tableTitle);

        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select distinct maSV,hoTen,ngaySinh,gioiTinh,queQuan,phone,email,SCMND,doiTuong,ghiChu from sinhVien,lopSH,nienKhoa,khoa where sinhVien.malopSH=lopSH.malopSH and khoa.makhoa = lopSH.makhoa and lopSH.maNK=nienKhoa.maNK and sinhVien.maSV='" + maSV + "';");
        createRecord(tableRecord, rs);
        table.setModel(new DefaultTableModel(tableRecord, tableTitle));
        return table;
    }
    //tim theo ten sinh vien

    public JTable timDSSVByTenSV(String tenSV, JTable table, Vector tableRecord, Vector tableTitle) throws Exception {
        tableRecord.removeAllElements();
        tableTitle.removeAllElements();

        createTitle(tableTitle);

        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select distinct maSV,hoTen,ngaySinh,gioiTinh,queQuan,phone,email,SCMND,doiTuong,ghiChu from sinhVien,lopSH,nienKhoa,khoa where sinhVien.malopSH=lopSH.malopSH and khoa.makhoa = lopSH.makhoa and lopSH.maNK=nienKhoa.maNK and sinhVien.hoTen=N'" + tenSV + "';");
        createRecord(tableRecord, rs);
        table.setModel(new DefaultTableModel(tableRecord, tableTitle));
        return table;
    }
    //tim theo ten lop sinh hoat

    public JTable timDSSVByTenLopSH(String tenLopSH, JTable table, Vector tableRecord, Vector tableTitle) throws Exception {
        tableRecord.removeAllElements();
        tableTitle.removeAllElements();

        createTitle(tableTitle);

        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select distinct maSV,hoTen,ngaySinh,gioiTinh,queQuan,phone,email,SCMND,doiTuong,ghiChu from sinhVien,lopSH,nienKhoa,khoa where sinhVien.malopSH=lopSH.malopSH and khoa.makhoa = lopSH.makhoa and lopSH.maNK=nienKhoa.maNK and lopSH.tenlopSH=N'" + tenLopSH + "';");
        createRecord(tableRecord, rs);
        table.setModel(new DefaultTableModel(tableRecord, tableTitle));
        return table;
    }
    //tim theo ten lop sinh hoat va nien khoa

    public JTable timDSSVByTenLopSHvaTenNK(String tenLopSH, String tenNK, JTable table, Vector tableRecord, Vector tableTitle) throws Exception {
        tableRecord.removeAllElements();
        tableTitle.removeAllElements();

        createTitle(tableTitle);

        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select distinct maSV,hoTen,ngaySinh,gioiTinh,queQuan,phone,email,SCMND,doiTuong,ghiChu from sinhVien,lopSH,nienKhoa,khoa where sinhVien.malopSH=lopSH.malopSH and khoa.makhoa = lopSH.makhoa and lopSH.maNK=nienKhoa.maNK and lopSH.tenlopSH=N'" + tenLopSH + "' and nienKhoa.tenNK='" + tenNK + "';");
        createRecord(tableRecord, rs);
        table.setModel(new DefaultTableModel(tableRecord, tableTitle));
        return table;
    }
    //xem Danh sach lop hoc phan theo makhoa va maNK    

    public JTable xemDSLopHP(String makhoa, String maNK, JTable table) throws SQLException, Exception {
        Vector tableTitle = new Vector();
        Vector tableRecord = new Vector();

        tableRecord.removeAllElements();
        tableTitle.removeAllElements();

        tableTitle.add("Mã lớp học phần");
        tableTitle.add("Tên lớp học phần");
        tableTitle.add("Ngày bắt đầu");
        tableTitle.add("Ngày kết thúc");
        tableTitle.add("Mã khoa");
        tableTitle.add("Mã niên khóa");
        tableTitle.add("Mã môn");
        tableTitle.add("Số tín chỉ");

        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select distinct maLopHP,tenLopHP,ngayBatdau,ngayKetthuc,makhoa,maNK,lopHP.maMH,soTC from lopHP,monHoc where khoa.makhoa='" + makhoa + "' and nienKhoa.maNK='" + maNK + "' and lopHP.maMH=monhoc.maMH");

        while (rs.next()) {
            Vector data = new Vector();
            data.add(rs.getString(1));
            data.add(rs.getString(2));
            data.add(rs.getString(3));
            data.add(rs.getString(4));
            data.add(rs.getString(5));
            data.add(rs.getString(6));
            data.add(rs.getString(7));
            data.add(rs.getString(8));
            tableRecord.add(data);
        }
        table.setModel(new DefaultTableModel(tableRecord, tableTitle));
        return table;
    }

    public ArrayList<SinhVienEntity> getAll() {
        SinhVienEntity svEntity;
        ArrayList<SinhVienEntity> list = new ArrayList<SinhVienEntity>();
        try {
            PreparedStatement ps = cs.getCon().prepareStatement("select * from sinhVien");
            ResultSet rs = ps.executeQuery();
            while (rs.next()) {
                svEntity = new SinhVienEntity();
                svEntity.setMaSV(rs.getString("maSV"));
                svEntity.setMalopSH(rs.getString("malopSH"));
                svEntity.setHoTen(rs.getString("hoTen"));
                svEntity.setNgaySinh(rs.getDate("ngaySinh"));
                svEntity.setGioiTinh(rs.getString("gioiTinh"));
                svEntity.setQueQuan(rs.getString("queQuan"));
                svEntity.setPhone(rs.getString("phone"));
                svEntity.setEmail(rs.getString("email"));
                svEntity.setSCMND(rs.getString("SCMND"));
                svEntity.setDoiTuong(rs.getString("doiTuong"));
                svEntity.setGhiChu(rs.getString("ghiChu"));
                
                
                

                list.add(svEntity);
            }
        } catch (Exception e) {
        }
        return list;
    }

    public ArrayList<SinhVienEntity> timKiem(String str, int id) {
        SinhVienEntity svEntity;
        ArrayList<SinhVienEntity> list = new ArrayList<SinhVienEntity>();
        try {
            PreparedStatement ps;
            if (id == 0) {
                ps = cs.getCon().prepareStatement("select * from sinhVien where maSV like N'%" + str + "%'");
            } else {
                ps = cs.getCon().prepareStatement("select * from sinhVien where hoTen like N'%" + str + "%'");
            }
            ResultSet rs = ps.executeQuery();
            while (rs.next()) {
                svEntity = new SinhVienEntity();
                svEntity.setMaSV(rs.getString("maSV"));
                svEntity.setMalopSH(rs.getString("malopSH"));
                svEntity.setNgaySinh(rs.getDate("ngaySinh"));
                svEntity.setGioiTinh(rs.getString("gioiTinh"));
                svEntity.setQueQuan(rs.getString("queQuan"));
                svEntity.setPhone(rs.getString("phone"));
                svEntity.setEmail(rs.getString("email"));
                
                
                svEntity.setHoTen(rs.getString("hoTen"));
                svEntity.setSCMND(rs.getString("SCMND"));
                svEntity.setDoiTuong(rs.getString("doiTuong"));
                svEntity.setGhiChu(rs.getString("ghiChu"));
                list.add(svEntity);
            }
        } catch (Exception e) {
        }
        return list;
    }

    public String LaytenKhoaByMaSV(String maSV) throws Exception {
        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select khoa.tenkhoa from khoa,lopSH,sinhVien,nienKhoa where khoa.makhoa = lopSH.makhoa and lopSH.malopSH=sinhVien.malopSH and nienKhoa.maNK = lopSH.maNK and sinhVien.maSV='" + maSV + "'");
        if (rs.next() == false) {
            return "";
        }
        return rs.getString(1);
    }

    public String LaytenLopSHByMaSV(String maSV) throws Exception {
        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select lopSH.tenlopSH from khoa,lopSH,sinhVien,nienKhoa where khoa.makhoa = lopSH.makhoa and lopSH.malopSH=sinhVien.malopSH and nienKhoa.maNK = lopSH.maNK and sinhVien.maSV='" + maSV + "'");
        if (rs.next() == false) {
            return "";
        }
        return rs.getString(1);
    }

    public String LaytenNKByMaSV(String maSV) throws Exception {
        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select nienKhoa.tenNK from khoa,lopSH,sinhVien,nienKhoa where khoa.makhoa = lopSH.makhoa and lopSH.malopSH=sinhVien.malopSH and nienKhoa.maNK = lopSH.maNK and sinhVien.maSV='" + maSV + "'");
        if (rs.next() == false) {
            return "";
        }
        return rs.getString(1);
    }

    public JComboBox cbbMakhoa(JComboBox cbb) throws Exception {
        cbb.removeAllItems();
        cbb.addItem("");
        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select tenkhoa from khoa");
        while (rs.next()) {
            cbb.addItem(rs.getString(1));
        }
        return cbb;
    }

    public JComboBox cbbLopSH(JComboBox cbb) throws Exception {
        cbb.removeAllItems();
        cbb.addItem("");
        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select  malopSH  from lopSH ");
        while (rs.next()) {
            cbb.addItem(rs.getString(1));
        }
        return cbb;
    }

    public JComboBox cbbNgay(JComboBox cbb) {
        cbb.removeAllItems();
        for (int i = 1; i < 32; i++) {
            cbb.addItem(i);
        }
        return cbb;
    }

    public JComboBox cbbThang(JComboBox cbb) {
        cbb.removeAllItems();
        for (int i = 1; i < 13; i++) {
            cbb.addItem(i);
        }
        return cbb;
    }

    public JComboBox cbbNam(JComboBox cbb) {
        cbb.removeAllItems();
        for (int i = 1900; i < 3000; i++) {
            cbb.addItem(i);
        }
        return cbb;
    }

    public JComboBox cbbNienkhoa(JComboBox cbb) throws Exception {
        cbb.removeAllItems();
        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select tenNK from nienKhoa");
        cbb.addItem("");
        while (rs.next()) {
            cbb.addItem(rs.getString(1));
        }
        return cbb;
    }
    int ngay;

    public int layngay(String maSV) throws Exception {
        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select day(sinhVien.ngaySinh) from sinhVien where maSV='" + maSV + "';");

        if (rs.next()) {
            ngay = Integer.parseInt(rs.getString(1));
        }
        return ngay;
    }
    int thang;

    public int laythang(String maSV) throws Exception {
        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select month(sinhVien.ngaySinh) from sinhVien where maSV='" + maSV + "';");

        if (rs.next()) {
            thang = Integer.parseInt(rs.getString(1));
        }
        return thang;
    }
    int nam;

    public int laynam(String maSV) throws Exception {
        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select year(sinhVien.ngaySinh) from sinhVien where maSV='" + maSV + "';");

        if (rs.next()) {
            nam = Integer.parseInt(rs.getString(1));
        }
        return nam;
    }

    public boolean kiemtraSDT(String str) {
        if (str.length() != 10 && str.length() != 11 && !str.equals("")) {
            return false;
        } else {
            for (int i = 0; i < str.length(); i++) {
                if (!Character.isDigit(str.charAt(i))) {
                    return false;
                }
            }
        }
        return true;
    }

    public boolean kiemtraCMTND(String str) {
        if (str.length() != 9) {
            return false;
        } else {
            for (int i = 0; i < str.length(); i++) {
                if (!Character.isDigit(str.charAt(i))) {
                    return false;
                }
            }
        }
        return true;
    }

    public String layMaNKByMaSV(String maSV) throws Exception {
        Statement st = cs.getCon().createStatement();
        ResultSet rs = st.executeQuery("select maNK from sinhVien,lopSH where sinhVien.malopSH=lopSH.malopSH and maSV='" + maSV + "'");
        if (rs.next()) {
            return rs.getString(1);
        }
        return rs.getString(1);
    }

    public String layHK(String MaSV) throws Exception {
        Date d = new Date();
        String maNK = layMaNKByMaSV(MaSV);
        int namdau = Integer.parseInt(maNK);
        int namhoc = d.getYear() + 1900 - namdau;
        String ki = "";
        int thanghtai = d.getMonth() + 1;
        switch (thanghtai) {
            case 8:
            case 9:
            case 10:
            case 11:
            case 12:
            case 1:
                ki = "kì 1";
                break;
            case 2:
            case 3:
            case 4:
            case 5:
            case 6:
            case 7:
                ki = "kì 2";
                break;
        }
        return ki + " năm " + namhoc;
    }
}
